package org.pizza.common.web.util;

import org.pizza.common.web.exception.BizException;
import org.pizza.common.web.model.response.Response;

/**
 * @author: fyh
 * @date: 2022/4/7
 */
public class ResponseUtil {

    public static <T> T check(Response<T> response) {
        if (response.isSuccess()) {
            return response.getData();
        } else {
            throw new BizException(response.getCode(), response.getMessage());
        }
    }
}
